//
//  RODatePickerDataModel.m
//  Runone
//
//  Created by runone02 on 16/12/14.
//  Copyright © 2016年 runone. All rights reserved.
//

#import "RODatePickerDataModel.h"

@implementation RODatePickerDataModel
//@"yyyy-MM-dd HH:mm:ss"
- (instancetype) initWithDate:(NSDate *)date {
    if (self = [super init]) {
        NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
        formatter.timeZone   = [NSTimeZone timeZoneWithAbbreviation:@"UTC"]; //设置时区
        formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";//时间格式,这没用zanshi 无解
        NSString *dateStr    = [NSString stringWithFormat:@"%@", date];
     //截取年月日时分秒的时间
        _yearStr   = [dateStr substringWithRange:NSMakeRange(0, 4)];
        _monthStr  = [dateStr substringWithRange:NSMakeRange(5, 2)];
        _dayStr    = [dateStr substringWithRange:NSMakeRange(8, 2)];
        _hourStr   = [dateStr substringWithRange:NSMakeRange(11, 2)];
        _minStr    = [dateStr substringWithRange:NSMakeRange(14, 2)];
        _secondStr = [dateStr substringWithRange:NSMakeRange(17, 2)];
    }
    return self;
}

@end
